/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DBManager;

import java.sql.*;


public class ConexionDB2 {

static Connection mConexion=null; 
    static final String mUrl = "jdbc:db2://192.168.56.101:5000/ADMIN";
    static final String mUsuario ="admin";
    static final String mClave="F0rrestm1nd";

    public static Connection getConnection() {
        if(mConexion==null)
        {
                   try {
            Class.forName("com.ibm.db2.jcc.DB2Driver");                             //Driver de la BD.
            try {
                mConexion = DriverManager.getConnection(mUrl, mUsuario, mClave);// Se establece la conexion.
            } catch (SQLException ex) {                                         //Manejo de excepciones.
                ex.printStackTrace();
            }
        } catch (ClassNotFoundException e) {
            System.out.println(e);
        } 
        }

        return mConexion;
    }
        public void desconectarBD(){
        try {
            mConexion.close();
        } catch (SQLException ex) {
           ex.printStackTrace();
        }
    }
}

